Skip to content

vrepl: CreateLookupVindex command with backfill#5692

Merged
sougou merged 10 commits intovitessio:masterfrom
planetscale:ss-create-lookup
Jan 15, 2020
Merged

vrepl: CreateLookupVindex command with backfill#5692
sougou merged 10 commits intovitessio:masterfrom
planetscale:ss-create-lookup

Conversation

@sougou
Copy link
Copy Markdown
Contributor

@sougou sougou commented Jan 13, 2020

This command comes very close to a DDL that can create a lookup vindex on an existing table that already has rows. It will:

  • Create a lookup vindex in the vschema in "write_only" mode.
  • Change the main table to use it.
  • Create the lookup table.
  • Create a vschema entry for the lookup table.
  • Setup vreplication from main table to lookup for the backfill.

If the table is the "owner", then the vreplication streams are created with "stop_after_copy" option. Otherwise, we assume that it's a "best effort" vindex where the lookup table is continuously populated by the vreplication stream.

The final step of this workflow will come in the next PR as ExternalizeVindex, which would remove the "write_only" mode and/or delete the vreplication streams.

Copy link
Copy Markdown
Collaborator

@deepthi deepthi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM except for a couple of nits.

"[-cell=<cell>] [-tablet_types=<tablet_types>] -workflow=<workflow> <source_keyspace> <target_keyspace> <table_specs>",
`Start a table(s) migration, table_specs is a list of tables or the tables section of the vschema for the target keyspace. Example: '{"t1":{"column_vindexes": [{""column": "id1", "name": "hash"}]}, "t2":{"column_vindexes": [{""column": "id2", "name": "hash"}]}}`},
{"CreateLookupVindex", commandCreateLookupVindex,
"[-cell=<cell>] [-tablet_types=<tablet_types>] <keyspace> <json_spec>",
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain tablet_types with more detail?

return err
}
if subFlags.NArg() != 2 {
return fmt.Errorf("two arguments are required: keyspace and specs")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

specs -> json_spec

sougou added 10 commits January 14, 2020 17:58
Convenience function to automatically choose a good vindex for
a type. Will be used for upcoming CreateLookupVindex functionality.

Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
@sougou sougou merged commit 1e10d2e into vitessio:master Jan 15, 2020
@sougou sougou deleted the ss-create-lookup branch January 15, 2020 02:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants